<template>
    <div class="topbar">
        <div class="menu-button">
            对齐
            <div class="menu">
                <div class="menu-item disabled" @click="itemOnClick('alignTop')">顶部对齐✅</div>
                <div class="menu-item disabled" @click="itemOnClick('alignBottom')">底部对齐✅</div>
                <div class="menu-item disabled" @click="itemOnClick('alignLeft')">左对齐✅</div>
                <div class="menu-item disabled" @click="itemOnClick('alignRight')">右对齐✅</div>
                <div class="menu-item disabled" @click="itemOnClick('horizontalCenter')">水平居中✅</div>
                <div class="menu-item disabled" @click="itemOnClick('verticalCenter')">垂直居中✅</div>
                <div class="menu-item disabled" @click="itemOnClick('horizontalSpace')">水平等间距✅</div>
                <div class="menu-item disabled" @click="itemOnClick('verticalSpace')">垂直等间距✅</div>
            </div>
        </div>

         <div class="menu-button">
             图层
             <div class="menu">
                 <div class="menu-item disabled" @click="itemOnClick('moveUp')">上移一层✅</div>
                <div class="menu-item disabled" @click="itemOnClick('moveDown')">下移一层✅</div>
                <div class="menu-item disabled" @click="itemOnClick('moveTop')">置顶✅</div>
                <div class="menu-item disabled" @click="itemOnClick('moveBottom')">置底✅</div>
            </div>
         </div>

    </div>
</template>

<script>

    export default {
        name: 'topbar',
        components: {
        },
        data() {
            return {

            }
        },
        mounted: function () {
        },
        beforeDestroy:function() {
        },

        methods: {
            itemOnClick(action){
                this.$bus.$emit('topbar-menuitem',action);
            },
        }
    }
</script>
<style scoped lang="less">
    .topbar {
        height: 50px;
        width: 100%;
        position: fixed;
        top: 0;
        left: 0;
        box-shadow: 3px 3px 3px lightgray;
        user-select: none;
        outline: none;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        z-index: 19;
    }

    .menu-button{
        margin-right: 10px;
        padding: 5px 10px;
        box-sizing: border-box;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        position: relative;

        &:hover{
            background: #f0f0f0;
            .menu{
                display: block;
            }
        }

        .menu{
            position: absolute;
            width: 150px;
            background: white;
            box-shadow: 0 0 5px lightgray;
            padding: 10px 0;
            box-sizing: border-box;
            top: 100%;
            display: none;

            .menu-item{
                line-height: 30px;
                padding: 0 20px;
                &:hover{
                    background: #f0f0f0;
                }
            }
        }
    }

    .button{
        cursor: pointer;
        border: 1px solid lightgray;
        padding: 5px 10px;
        border-radius: 4px;
        margin-right: 5px;
    }

    .disabled{
    }

</style>
